<!--
 * @Author: liaoxing
 * @Date: 2022-01-19 13:37:36
 * @LastEditors: liaoxing
 * @LastEditTime: 2022-03-04 17:11:50
 * @Description: liaoxing created
 * @FilePath: \pin-xin-admin\src\views\business\quote\params\tableTemplate.vue
-->
<template>
  <el-table
    :data="dataList"
    border
    stripe
    :row-key="type + 'maps131'"
    style="width: 100%;"
    height="650px" 
  >
    <!-- <el-table-column prop="name" label="分类ID" width="120"></el-table-column> -->
    <el-table-column prop="parameterName" label="参数名称"></el-table-column>
    <el-table-column prop="parameterCode" label="编码"></el-table-column>
    <!-- <el-table-column prop="parameterType" label="参数类型"></el-table-column> -->
    <!-- <el-table-column prop="parameterHandler" label="参数处理器"></el-table-column> -->
    <template v-if="type != 'ASSEMBLE'">
      <el-table-column prop="parameterValueFromName" label="数据来源"></el-table-column>
      <!-- <el-table-column prop="botHandler" label="系统处理器"></el-table-column> -->
      <template v-if="type != 'BOT'">
        <el-table-column prop="parameterValueMaintainerName" label="维护人"></el-table-column>
        
        <!-- <el-table-column prop="durationType" label="有效期">
          <template slot-scope="scope">
            <el-tag>
              {{ scope.row.durationType ? '区间性' : '一次性' }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="dependency" label="依赖">
          <template slot-scope="scope">
            <span>{{ scope.row.dependency * 1 ? scope.row.dependency : '--' }}</span>
          </template>
        </el-table-column> -->
      </template>
      <el-table-column prop="parameterItemValue" label="当前数值">
        <template slot-scope="scope">
          {{ scope.row.parameterItemValue }}
        </template>
      </el-table-column>
      
    </template>
    
    <template v-else>
      <el-table-column prop="attr" label="属性"></el-table-column>

      <el-table-column label="是否为效率清单项">
        <template slot-scope="scope">
          {{ scope.row.isEfficiencyItem ? "是" : "否" }}
        </template>
      </el-table-column>

      <el-table-column prop="calculator" label="公式"></el-table-column>
      <el-table-column prop="calculatorText" label="中文公式"></el-table-column>
    </template>


    
    <el-table-column label="操作" width="110">
      <template slot-scope="scope">
        <el-popconfirm
          v-if="scope.row.parameterType != 'BOT'"
          title="确定删除该参数吗？"
          @confirm="deleteItem(scope.row.id)"
        >
          <span
            slot="reference"
            class="jstarfont jstar-shanchutianchong finger"
          ></span>
        </el-popconfirm>
        <el-tooltip content="编辑" placement="top" effect="dark">
          <span
            class="jstarfont jstar-bianji1 finger"
            @click="editItem(scope.row)"
          ></span>
        </el-tooltip>

        <el-tooltip content="设置值" placement="top" effect="dark">
          <span
            v-if="scope.row.parameterType == 'BASE' || scope.row.parameterType == 'BOT'"
            class="jstarfont jstar-shezhi finger"
            @click="setItem(scope.row)"
          ></span>
        </el-tooltip>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  props: ['dataList', 'type'],
  methods: {
    deleteItem (item) {
      this.$emit('deleteItem', item)
    },
    editItem (item) {
      this.$emit('editItem', item)
    },
    setItem (item) {
      this.$emit('setItem', item)
    }
  }
}
</script>

<style>

</style>